﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;


namespace BLL
{
    public class MaHoaMD5
    {
        public static string EncryptMD5(string data)
        {

            MD5CryptoServiceProvider MD5 = new MD5CryptoServiceProvider();

            byte[] b = System.Text.Encoding.UTF8.GetBytes(data);

            b = MD5.ComputeHash(b);

            StringBuilder s = new StringBuilder();

            foreach (byte p in b)
            {

                s.Append(p.ToString("x").ToLower());

            }

            return s.ToString();

        }
    }
}
